/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 100;

int main() {
  int t;
  cin >> t;
  while (t--) {
    int q;
    cin >> q;
    int head = -1, tail = -1;
    bool flag = false;
    while (q--) {
      int x;
      cin >> x;
      if (head == -1) {
        head = x;
      }
      if (flag) {
        if (x <= head && x >= tail) {
          tail = x;
          cout << 1;
        } else {
          cout << 0;
        }
      } else {
        if (x >= tail) {
          tail = x;
          cout << 1;
        } else if (x <= head) {
          tail = x;
          flag = true;
          cout << 1;
        } else {
          cout << 0;
        }
      }
    }
    cout << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("B. Keep it Beautiful.in", "r", stdin);
  freopen("B. Keep it Beautiful.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
